#pragma once

#include "head.h"
#include "task_queue.h"

class ThreadPoll: public NoCopyable{
private:
    vector<thread> poll_;
    bool isRunning_;
    size_t threads_;
    size_t taskCapacity_;
    TaskQueue tasks_;

private:
    void run_();

public:
    /// @brief  初始化线程池
    /// @param threads 线程的数量
    /// @param tasks 任务的容量
    ThreadPoll(int threads, int taskCapacity);
    ~ThreadPoll();
    int addTask(Task *task);
    void stop();
};